package tech.aistar.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import tech.aistar.entity.User;

import java.util.List;

/**
 * 本类用来演示:
 *
 * @author jyz
 * @date 2023/3/11 18:30:14
 */
@Mapper
public interface UserMapper extends BaseMapper<User>{

    @Select("select * from mm_user")
    List<User> findAll();

    @Select("select * from mm_user where id=#{value}")
    User getUser(int id);

    @Delete("delete * from mm_user where id=#{value} ")
    int delete (int id);

    @Insert("insert into mm_user (id,username,password,sex,city,phone)values(#{id},#{username},#{password},#{sex},#{city},#{phone})")
    int save (User user);

    @Update("update mm_user set id=#{id},username=#{username},password=#{password},sex=#{sex},city=#{city},phone=#{phone}")
    int update(User user);

    @Select("select * from mm_user where phone=#{value}")
    User getByEmail(String phone);
}
